import pymysql
class connectMysql:
    def __init__(self,database):
        self.con = pymysql.connect(host='10.51.2.4',user='pvuser',password='XH33tSm1JT0U8Jqt',database=database)
        self.cur = self.con.cursor()

    def selectsql(self,sql):
        self.cur.execute(sql)
        t = self.cur.fetchall()
        self.con.close()
        print(t)
        return t

    def delsql(self,sql):
        self.cur.execute(sql)
        t = self.cur.fetchall()
        self.con.commit()
        self.con.close()
        return t


if __name__ == '__main__':
    connectMysql('iot_platform').selectsql("select * from pomp_power_plant_basic where power_name = '王超'")